//
//  NetWorkState.m
//  HappyBaby
//
//  Created by lanou on 15/11/25.
//  Copyright © 2015年 华哥. All rights reserved.
//

#import "NetWorkState.h"
#import "Reachability.h"

@implementation NetWorkState

+ (NetWorkState *)shareInstance
{
    static NetWorkState *state = nil;
    static dispatch_once_t onceToken;
    dispatch_once(&onceToken, ^{
        state = [[NetWorkState alloc] init];
    });
    return state;
}

// 判断网络装状态
- (BOOL) reachAbility
{
    Reachability *reach = [Reachability reachabilityWithHostName:@"www.baidu.com"];
    switch ([reach currentReachabilityStatus]) {
        case NotReachable:{
            return NO;
        }
        case ReachableViaWWAN:{
            return YES;
        }
        case ReachableViaWiFi:{
            return YES;
        }
        default:
            break;
    }
}

@end
